package question6;

/**
 * 定义一个父类 Animal
 * @FileName Animal
 * @Description
 * @Author Sword
 * @date 2024-10-11
 **/
public class Animal {
    //包含 public 成员属性name age与方法showProfile()
    public String name;
    public int age;


    public Animal() {
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String showProfile() {
        return "Animal{name = " + name + ", age = " + age + "}";
    }

    public void speak(){
        System.out.println("说话");
    }
}
